import {defineStore} from 'pinia'
import {ref} from 'vue'

export const useTokenStore = defineStore('token', ()=>{
    //响应式数据
    const token = ref('');
    //定义函数，修改token的值
    const setToken = (newToken)=>{
        token.value = newToken;
    }
    //定义函数，移除token的值
    const removeToken = ()=>{
        token.value = ''
    }

    return {
        token,setToken,removeToken
    }
},{
    persist:true
});